package com.base.www.test2;

import java.util.HashSet;
import java.util.Set;

/**
 * Created by guoqi on 2017/7/28.
 */
public class Test {
    public static void main(String[] args){
        Set<Integer> integerSet = new HashSet();
        Set<Double> doubleSet = new HashSet();
//        Set<Number> numbers = union(integerSet, doubleSet);
        Set<Number> numbers = Test.<Number>union(integerSet, doubleSet);
    }

    public static <E> Set<E> union(Set<? extends E> s1, Set<? extends E> s2){
        Set<E> result = new HashSet(s1);
        result.addAll(s2);
        return result;
    }
}
